
class SearchIndexer

  class << self

    def perform_later op, class_name, object_id

      obj = Object.const_get(class_name).find(object_id)
      if op == "update"
        obj.__elasticsearch__.update_document
      elsif op == "delete"
        obj.__elasticsearch__.delete_document
      elsif op == "index"
        obj.__elasticsearch__.index_document
      end
    end

  end

end
